#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 1e4 + 5;
const int M = 1e9 + 7;

int t, n, a[N];

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> t;
    while (t--)
    {
        cin >> n;
        memset(a, 0, sizeof(a));
        for (int i = 1; i <= n; i++)
            cin >> a[i];

        if (a[1] == 1)
        {
            cout << n + 1 << ' ';
            for (int i = 1; i <= n; i++)
            {
                cout << i << ' ';
            }
            cout << endl;
        }
        else if (a[n] == 0)
        {
            for (int i = 1; i <= n; i++)
            {
                cout << i << ' ';
            }
            cout << n + 1 << endl;
        }
        else
        {
            int pos = -1;
            for (int i = 1; i < n; i++)
            {
                if (a[i] == 0 || a[i + 1] == 1)
                {
                    pos = i;
                    break;
                }
            }

            if (pos != -1)
            {
                for (int j = 1; j <= pos; j++)
                    cout << j << ' ';
                cout << n + 1 << ' ';
                for (int j = pos + 1; j <= n; j++)
                    cout << j << ' ';
                cout << endl;
            }
            else
            {
                cout << -1 << endl;
            }
        }
    }

    return 0;
}